<script>
ajaxUpload.type='order';
ajaxUpload.formid='orderMoreForm';
</script>
<div class="frame_orderDiv">
<form  name="orderMoreForm" enctype="multipart/form-data" id="orderMoreForm"  action="administrator-order-setoderfl?orderid=<?=$this->orderArray[0]['orderid']?>" method="post">

  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td width="15%" class="ri-bbgg"> 订单号：</td>
      <td width="85%" class="le">G<?=$this->orderArray[0]['orderid']?></td>
    </tr>
    <tr>
      <td valign="top" class="ri-bbgg"> 下订时间：<br />付款时间： </td>
      <td class="le">
		  <?=date('Y-m-d H:i:s',$this->orderArray[0]['add_time'])?>
		  <br />
		  <?if($this->orderArray[0]['pay_time']!='0'):?>
		  	<?=date('Y-m-d H:i:s',$this->orderArray[0]['pay_time'])?>
		  <?else:?>
		  	未付款
		  <?endif;?>
	  </td>
    </tr>
    <tr>
      <td valign="top" class="ri-bbgg"> 买 家：</td>
      <td class="le">		   <?if (!empty($this->orderArray[0]['username'])):?>		  		<?php echo $this->orderArray[0]['username'];?>		  		<?php 		  			$memberattr = new CMemberattr();					$row = $memberattr->getAttr('facebook', $this->orderArray[0]['uid']);					if ($row) {						echo 'Facebook: ' . $row->attr_value . '    ';					}								        $row = $memberattr->getAttr('twitter', $this->orderArray[0]['uid']);					if ($row) {						echo 'Twitter: ' . $row->attr_value;					}		  		?>		   <?php else:?>		   		<?php 		   			$buyer = new CBuyer();		   			$user = $buyer->getUserDetails(array('uid'=>$this->orderArray[0]['uid']));		   			echo '注册自' . $this->orderArray[0]['reg_from'] . ' : ' . $user[0]['nick_name'];		   		?>		   <?php endif;?>		  </td>
    </tr>
    <tr>
      <td valign="top" class="ri-bbgg"> 卖 家：</td>
      <td class="le"><?=$this->orderArray[0]['seller_name']?></td>
    </tr>
    <tr>
      <td class="ri-bbgg"> 快递公司：</td>
      <td class="le">
		<?=$this->oneyunfeiArray[0]['carrier']?> &nbsp; &nbsp;   时间 ：<?=$this->oneyunfeiArray[0]['transittime']?> 天&nbsp; &nbsp;  费用：$<?=$this->orderArray[0]['yunfeiprice']?>
	  </td>
    </tr>
    <tr>
      <td class="ri-bbgg"> 订单金额：</td>
      <td class="le">		$<?=$this->orderArray[0]['money']?>		 用的积分：$<?php echo $this->orderArray[0]['coupon'];?>		本来应付：$<?php echo ($this->orderArray[0]['money']+$this->orderArray[0]['coupon']);?>		是否使用优惠券：<?php if ($this->orderArray[0]['usecouponcode']) {echo '是';} else {echo '否';}?>		是否使用会员优惠：<?php if ($this->orderArray[0]['usememberdiscount']) {echo '是';} else {echo '否';}?>		带费率应付：<?php echo $this->orderArray[0]['money'] * $this->orderArray[0]['fee_rate'];?>
	  </td>
    </tr>    
    <tr>
      <td valign="top" class="ri-bbgg"> 状 态：</td>
      <td class="le">
	  	<?=$this->orderArray[0]['flname']?>&nbsp;&nbsp;
		<?if($this->orderArray[0]['flid']=='1'):?>
	  		<input onclick="parent.userPmInfo.mustFlid='2';parent.userPmInfo.orderid='<?=$this->orderArray[0]['orderid']?>';parent.userPmInfo.sendTo='<?=$this->orderArray[0]['username']?>';parent.userPmInfo.show();" type="button" value="向买家催款" />
		<?elseif($this->orderArray[0]['flid']=='3'):?>
			<tr>
			  <td valign="top" class="ri-bbgg"> 设置为已发货：</td>
			  <td class="le">
				<input type="button" onclick="setOrderShipped();" value="设定" />
			  </td>
			</tr>
		<?endif;?>
                        <tr>
			  <td valign="top" class="ri-bbgg"> 输入运单号：</td>
			  <td class="le">
				<input name="usernameemail" type="hidden" value="<?=$this->orderArray[0]['username']?>" />
				<input name="yunfeicarrier" type="hidden" value="<?=$this->oneyunfeiArray[0]['carrier']?>" />
				<input name="transittime" type="hidden" value="<?=$this->oneyunfeiArray[0]['transittime']?>" />
				<input name="website" type="hidden" value="<a href=<?=$this->oneyunfeiArray[0]['yurl']?>><?=$this->oneyunfeiArray[0]['yurl']?></a>" />
				                <input name="sendid" type="text" value="<?=$this->orderArray[0]['sendid']?>" />
                                <input type="button" onclick="setOrdersetsendid();" value="确定" />
			  </td>
			</tr>
	  </td>
    </tr>
	<tr>
      <td class="ri-bbgg"> Payment：</td>
      <td class="le">
	  	<strong><?=$this->orderArray[0]['payment']?></strong>
		<?=$this->getPayment($this->orderArray[0]['payment']);?>		<?php 			$westInfo = new CWestinfo();			if ($row = $westInfo->fetchRow(array('orderid=?'=>$this->orderArray[0]['orderid']))) {				echo '<br/>Payment MTCN:'. $row->mtcn . ', Payment Sender Name:' . $row->send_name;			}		?>
     </td>
    </tr>
    <tr>
      <td valign="top" class="ri-bbgg"> 商品详情：</td>
      <td class="le">
          <?if($this->itemArray){?>
	  	<?foreach($this->itemArray as $value):?>
			<div class="orderItemsDiv">
				<div class="orderItemsLeft"><a target="_blank" href="<?php echo $this->url($value['itemid']);?>"><img src="<?=$value['cut_url']?>" /></a></div>
				<div class="orderItemsRight">
					<div>Products name: <?=$value['subject']?></div>
					<div>Unit price　: $<?=$this->numberFormat($value['net_price'],2)?></div>
					<div>Quantity: <?=$value['amounts']?></div>
					<div>Total amount: $					<?php 						$totalPrice = 0;		           		if ($value['buy_name_num'] == '' and $value['buy_originalname_num'] == '')		                {				                    $totalPrice+=$value['amounts'] * $value['net_price'];		                } else		                {		                    $totalPrice+=$value['amounts'] * $value['net_price'] + $value['originalprintAmounts'] * PRINT_ORIGINAL_PRICE + $value['printAmounts'] * PRINT_CUSTOM_PRICE;		                }				                if ($value['buy_BadgePatch'] == 'Yes')		                {		                    $totalPrice+=$value['badge_patch_money'];		                }		                echo $totalPrice;					?>										</div>
					<div>Specifications：<?=$value['pattern_name']?></div>
					<div>Size：<?=$value['buy_pattern_size']?></div>
                                        <!-- <div>badge patch：<?=$value['buy_BadgePatch']?> <?=$value['select_badgepatch']?></div>                                        <div>Badge Patch for size:<?=$value['badgepatchforsize']?></div>
                                        <div><strong>Not Original number and name:</strong></div> 
					<div>Print number or not：<?=$value['buy_name_num']?></div>
					<div>The quantity to print：<?=$value['printAmounts']?></div>-->
					<div>Memo：<?=$value['printMesg']?></div>					<?php if($value['accessory']):?>					<div>Accessory:	<?php echo $value['accessory'];?></div>					<?php endif;?>
                                        <div>&nbsp;&nbsp;</div>
                                        <!-- <div><strong>Original number and name:</strong></div>
					<div>Print number or not：<?=$value['buy_originalname_num']?></div>
					<div>The quantity to print：<?=$value['originalprintAmounts']?></div>
					<div>Memo：<?=$value['originalprintMesg']?></div>
					<div> -->
							<input id="itemInput<?=$value['itemid']?>" type="button" onclick="parent.orderExpress.orderid='<?=$this->orderArray[0]['orderid']?>';parent.orderExpress.itemid='<?=$value['itemid']?>';parent.orderExpress.shipping_cost='<?=$this->numberFormat($value['amounts']*$value['item_shipping_cost'],2)?>';parent.orderExpress.mode='express';parent.orderExpress.show()" value="Shipping Info" />
					</div>
				</div>
				<div class="clear"></div>
			</div>
		<?endforeach;?>
           <?}?>
	  </td>
    </tr>	 <tr>      <td class="ri-bbgg"> Remark：</td>      <td class="le">		<?php echo $this->orderArray[0]['msg'];?>	  </td>    </tr>
   <!--  <tr>
      <td valign="top" class="ri-bbgg"> 赠品：</td>
      <td class="le">	
                    <?if($this->LagnappeArray):?>
			<div class="orderItemsDiv">
				<div class="orderItemsLeft"><img src="<?=$this->attachmentArray3[0]['attachment_url']?>" /></div>
				<div class="orderItemsRight">
					<div>Products name: <?=$this->LagnappeArray[0]['ltitle']?></div>
                                        <div>Quantity: 1</div>
					<div>Total amount: $<?=$this->numberFormat($this->LagnappeArray[0]['price'],2)?></div>
                                        <div>Memo: <?=$this->orderArray[0]['LagnappeMesg']?></div>
				</div>
				<div class="clear"></div>
			</div>
                    <?endif;?>&nbsp;
	  </td>
    </tr> -->
	<?if($this->orderArray[0]['flid']=='8'):?>
    <tr>
      <td valign="top" class="ri-bbgg"> 重新开启订单：</td>
      <td class="le">
	  	<input type="hidden" value="2" name="flid" /><input type="button" onclick="$('#orderMoreForm').submit();" value="开启" />
	  </td>
    </tr>
    <tr>
      <td valign="top" class="ri-bbgg"> 退款：</td>
      <td class="le">
	  	<input type="button" value="退款给<?=$this->orderArray[0]['username']?>" />
	  </td>
    </tr>
	<?elseif($this->orderArray[0]['flid']=='7'):?>
    <tr>
      <td valign="top" class="ri-bbgg"> 重新开启订单：</td>
      <td class="le">
	  	<input type="hidden" value="1" name="flid" /><input type="button" onclick="$('#orderMoreForm').submit();" value="开启" />
	  </td>
    </tr>
	<?elseif($this->orderArray[0]['flid']=='5'):?>
    <tr>
      <td valign="top" class="ri-bbgg"> 设置为已完成：</td>
      <td class="le">
	  	<input type="button" onclick="setOrderComplete();" value="设定" />
	  </td>
    </tr>
	<?endif;?>
    <tr>
      <td valign="top" class="ri-bbgg"> 强制设定状态：</td>
      <td class="le">
	  	<select name="orderStateId">
			<option value="0">非必要请不要执行</option>
			<?foreach($this->orderStateArray as $state):?>
			<option value="<?=$state['flid']?>"><?=$state['flname']?></option>
			<?endforeach;?>
		</select>
		&nbsp;&nbsp;
		<input type="button" onclick="setOrderState();" value="设定" />
	  </td>
    </tr>    <?php   	$suggestionModel = new CSuggestion();  	if ($suggestion = $suggestionModel->getByOrderId($this->orderArray[0]['orderid'])) {  ?>    	<tr>	  <td valign="top" class="ri-bbgg">建议：</td>	   <td class="le"><?php echo $suggestion->content;?>  	   <?php if ($suggestion->flag == 0):?>	   <input type="button" onclick="setSuggestion(<?php echo $suggestion->suggestion_id;?>);" value="采纳" />	   <?php else:?>	  		 已采纳	   <?php endif;?>	   </td>	</tr>	</table>  <?php	  	}  ?>    <!--     <tr>      <td valign="top" class="ri-bbgg">积分情况：</td>      <td class="le">		<?php 		  	$score = new CScore();											if ($this->orderArray[0]['flid'] >= 2 && $this->orderArray[0]['flid'] != 6 && $this->orderArray[0]['flid'] != 7 && $this->orderArray[0]['flid'] != 8) {				if ($this->orderArray[0]['order_score_statu'] == 0 && $this->orderArray[0]['order_score_statu'] == 0) {					echo '未派送 ,应送' . $score->dollar2score(round($this->orderArray[0]['money']*$this->orderArray[0]['discount'],2));				} elseif ($this->orderArray[0]['order_score_statu'] == 1 && $this->orderArray[0]['order_score_statu'] == 1) {					echo '已派送';				}			} else {				echo '未付款或取消';			}		?>	  </td>    </tr> -->
	<!--
	<tr>
	  <td class="ri-bbgg">发货前照片：</td>
	  <td class="le">
		<div>
			<?for($i=0;$i<count($this->attachmentArray);$i++):?>
			<div style="margin:10px"><a href="<?=$this->attachmentArray[$i]['attachment_url']?>" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->attachmentArray[$i]['attachment_url']?>" /></a> <input type="hidden" name="imgUrl[]" value="<?=$this->attachmentArray[$i]['attachment_url']?>" /></div>
			<?endfor;?>
		</div>
	  </td>
	</tr>
	<?if($this->orderArray[0]['flid']!='1'&&$this->orderArray[0]['flid']!='2'):?>
    <tr>
      <td valign="top" class="ri-bbgg"> 上传收货后照片：</td>
      <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="ajaxUpload.orderid='<?=$this->orderArray[0]['orderid']?>';ajaxUpload.uploadimg(this);" value="上传" />　( 可连续上传多幅 )</td>
    </tr>
	<tr>
	  <td class="ri-bbgg">收货后照片：</td>
	  <td class="le">
		<div id="productImages">
			<?for($i=0;$i<count($this->attachmentArray2);$i++):?>
			<div style="margin:10px"><a href="<?=$this->attachmentArray2[$i]['attachment_url']?>" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->attachmentArray2[$i]['attachment_url']?>" /></a> <input type="hidden" name="imgUrl[]" value="<?=$this->attachmentArray2[$i]['attachment_url']?>" />　　<input type="button" value="删除" onclick="ajaxUpload.delimgbyid(this);" /><input type="hidden" value="<?=$this->attachmentArray2[$i]['attachmentid']?>" name="attachmentid[]" /></div>
			<?endfor;?>
		</div>
		<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
	</tr>
	<?endif;?>
	-->
  </table>  
  <br />
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
  	<tr>
	  <td colspan="2">订单备注</td>
	</tr>
	<?if($this->disputeRemarkArray[0]['content']!=''):?>
	<tr>
      <td width="25%" valign="top" class="ri-bbgg"> 纠纷原因：</td>
      <td width="75%" class="le"><?=$this->disputeRemarkArray[0]['content']?></td>
    </tr>
	<?endif;?>
	<?if($this->reimburseRemarkArray[0]['content']!=''):?>
	<tr>
      <td width="25%" valign="top" class="ri-bbgg"> 要求退款原因：</td>
      <td width="75%" class="le"><?=$this->reimburseRemarkArray[0]['content']?> <a href="administrator-account-more?accountid=<?=$this->reimburseAccountArray[0]['accountid']?>&flid=5">查看该帐目</a></td>
    </tr>
	<?endif;?>
	<?if($this->cancelDisputeRemarkArray[0]['content']!=''):?>
	<tr>
      <td width="25%" valign="top" class="ri-bbgg"> 取消纠纷原因：</td>
      <td width="75%" class="le"><?=$this->cancelDisputeRemarkArray[0]['content']?></td>
    </tr>
	<?endif;?>
	<?if($this->cancelReimbursementArray[0]['content']!=''):?>
	<tr>
      <td width="25%" valign="top" class="ri-bbgg"> 取消退款原因：</td>
      <td width="75%" class="le">
	  	<div><?=$this->cancelReimbursementArray[0]['content']?></div>
		<?if($this->reimburseAccountArray[0]['accountid']!=''):?>
		<div><a href="administrator-account-more?accountid=<?=$this->reimburseAccountArray[0]['accountid']?>&flid=5">查看该帐目</a></div>
		<?endif;?>
	  </td>
    </tr>
	<?endif;?>
  </table>
  </form>
</div>
<script>
function setOrderState(){
	var state=$('select[name="orderStateId"]').val();
	if(state=='0'){
		alert('请选择要设定的状态!');
		return false;
	}
	if(confirm("确定要把此订单设定该状态吗?")){
		$('#orderMoreForm').attr('action','administrator-order-setstate?orderid=<?=$this->orderArray[0]['orderid']?>&uid=<?=$this->orderArray[0]['uid']?>&acctualTotal=<?=$this->orderArray[0]['money']?>&state='+state);
		$('#orderMoreForm').submit();
	}
}
function setOrderComplete(){
	if(confirm("确定要把此订单设定完成状态吗?")){
		$('#orderMoreForm').attr('action','administrator-order-setcomplete?orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}
function setOrderShipped(){
	if(confirm("确定要把此订单设为已发货吗?")){
		$('#orderMoreForm').attr('action','administrator-order-setshipped?orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}function setSuggestion(id){	if(confirm("确定要采纳此建议?")){		$('#orderMoreForm').attr('action','administrator-order-suggestion?id='+id);		$('#orderMoreForm').submit();	}}
function setOrdersetsendid(){
	if(confirm("确定要输入吗?")){
		$('#orderMoreForm').attr('action','administrator-order-setsendid?orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}
function approveOrder(type){
	if(type=='0'){
		if(!confirm("确定不能通过申请？")){
			return false;
		}
		$('#orderMoreForm').attr('action','administrator-order-doapprove?has_approved=2&orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}else if(type=='1'){
		if(!confirm("确定要通过申请？")){
			return false;
		}
		$('#orderMoreForm').attr('action','administrator-order-doapprove?has_approved=1&orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}

<?if(count($this->scoreArray)==0):?>
$('.score_no').mouseover(
	function(){
		fullFillScore($(this));
	}
);
$('.score_no').mouseout(
	function(){
		$(this).parent().find('a').attr('className','score_no');
		$(this).parent().find('label:last').html('');
	}
);
function fullFillScore(thisA){
	thisA.attr('className','score_yes');
	while(true){
		var thisA=$(thisA).prev();
		if(thisA.attr('className')!='score_no'){
			break;
		}else{
			thisA.attr('className','score_yes');
		}
	}
	var index=thisA.parent().find('.score_yes').length;
	thisA.parent().find('label:last').html('&nbsp;&nbsp;'+index+' Point(s)');
}
$('.score_no').click(
	function(){
		$(this).parent().find('a').attr('className','score_no');
		fullFillScore($(this));
		$(this).parent().find('a').unbind('mouseover');
		$(this).parent().find('a').unbind('mouseout');
		var index=$(this).parent().find('.score_yes').length;
		$(this).parent().find('label:last').html('&nbsp;&nbsp;'+index+' Point(s)');
		$(this).parent().find('input').val(index);
	}
);
function doscore(){
	var isTrue=true;
	$('.orderScore input').each(
		function(){
			if($(this).val()=='0'){
				isTrue=false;
				alert('请评分！');
				return false;	
			}
		}
	);
	if(isTrue){
		$('#orderMoreForm').attr('action','administrator-score-doscore?&orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}
<?endif;?>
function doAccidentCost(){
	if(!numTest($('#accident_cost').val())){
		alert('请正确填写意外扣减费！');
		return false;
	}
	if(confirm("确定要设置意外扣减费吗?")){
		$('#orderMoreForm').attr('action','administrator-order-doaccidentcost?orderid=<?=$this->orderArray[0]['orderid']?>');
		$('#orderMoreForm').submit();
	}
}
</script>